﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace TaoGL_UserControl
{
    static class TimeMgr
    {
        //======================================================================
        [DllImport("Kernel32.dll")]
        public static extern void GetLocalTime(SystemTime st);
        [DllImport("Kernel32.dll")]
        public static extern void SetLocalTime(SystemTime st);

        [StructLayout(LayoutKind.Sequential)]
        public class SystemTime
        {
            public ushort wYear;
            public ushort wMonth;
            public ushort wDayOfWeek;
            public ushort wDay;
            public ushort Whour;
            public ushort wMinute;
            public ushort wSecond;
            public ushort wMilliseconds;
        }

        //======================================================================
        static public int GetNowLocalTimeMilliseconds()
        {
            SystemTime stime = new SystemTime();
            GetLocalTime(stime);
            return (stime.wMinute * 60000 + stime.wSecond * 1000 + stime.wMilliseconds);
        }


    }
}
